package com.zecan.blog.vo.article;

import com.zecan.blog.entity.Article;
import lombok.Data;

/**
 * @ClassName BlogIndexArticleVo
 * @Description
 * @date 2022/11/23 15:03
 * @Version 1.0
 */
@Data
public class BlogIndexArticleVo {
    Integer articleId;
    Long articleAuthorId;
    String articleTitle;
    String articleDescription;
    String articleImgUrl;
    String articleAuthorName;
    String articleAuthorAvatar;
    String articleCreateTime;
    String articleClassify;
    Integer articleLikeCount;
    Integer articleView;


    public static BlogIndexArticleVo buildBlogIndexArticleVo(
            Article article) {
        BlogIndexArticleVo blogIndexArticleVo = new BlogIndexArticleVo();
        blogIndexArticleVo.articleId = article.getArticleId();
        blogIndexArticleVo.articleAuthorId = article.getArticleAuthorId();
        blogIndexArticleVo.articleAuthorAvatar = article.getArticleAuthorAvatar();
        blogIndexArticleVo.articleTitle = article.getArticleTitle();
        blogIndexArticleVo.articleAuthorName = article.getArticleAuthorName();
        blogIndexArticleVo.articleCreateTime = article.getArticleCreateTime();
        blogIndexArticleVo.articleClassify = article.getArticleClassify();
        blogIndexArticleVo.articleImgUrl = article.getArticleImage();
        blogIndexArticleVo.articleLikeCount = article.getArticleLikeCount();
        blogIndexArticleVo.articleDescription = article.getArticleDescription();
        blogIndexArticleVo.articleView = article.getArticleViews();
        return blogIndexArticleVo;
    }
}
